/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Bean;

import Action.AboutUsSessionBean;
import Entity.AboutUs;
import java.util.List;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;


/**
 *
 * @author duongdm_b00092
 */
@ManagedBean
@SessionScoped
public class AboutUsBean {

   
    List<AboutUs> list;
    private AboutUs about;
    private AboutUs listab;
    @EJB
    private AboutUsSessionBean aboutUsSessionBean;

    /** Creates a new instance of AboutUsBean */
    public AboutUsBean() {
        about = new AboutUs();
    }

    public AboutUs viewDetail(){
        return getAbout();
    }
    public List<AboutUs> getviewAboutUs() {
        list = aboutUsSessionBean.viewAllAboutUs();
        return list;
    }

    public void deleteAboutUs(AboutUs au){
        aboutUsSessionBean.deleteAboutUs(au);
        //return "AboutUs.xhtml";
    }

    public void updateAboutUs(){

         int Id=getAbout().getAbID();
         aboutUsSessionBean.updateAboutUs(Id,about.getContent());
    }

    public void addAboutUs(){
        aboutUsSessionBean.addAboutUs(about);
    }

    /**
     * @return the about
     */
    public AboutUs getAbout() {
        return about;
    }

    /**
     * @param about the about to set
     */
    public void setAbout(AboutUs about) {
        this.about = about;
    }

    /**
     * @return the listab
     */
    public AboutUs getListab() {
        return listab;
    }

    /**
     * @param listab the listab to set
     */
    public void setListab(AboutUs listab) {
        this.listab = listab;
    }
}
